<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="public/layui/css/layui.css">
    <link rel="stylesheet" href="css/style.css">


</head>
<body>


<div class="login-main">
    <header class="layui-elip">简单业务接入平台</header>
    <form class="layui-form" id="loginForm">
        <div class="layui-input-inline">
            <input type="text" name="userName" lay-verify="required" placeholder="用户名" autocomplete="off"
                   class="layui-input" value="admin">
        </div>
        <div class="layui-input-inline">
            <input type="password" name="password" lay-verify="required" placeholder="密码" autocomplete="off"
                   class="layui-input" value="1qaz">
        </div>

        <div class="layui-input-inline login-btn">
            <button class="layui-btn" id="login" lay-submit="" lay-filter="login">登录</button>
        </div>
        <hr>
        <p class="copyinfo">ESAP平台</p>
    </form>
</div>


<script src="public/layui/layui.js" charset="utf-8"></script>
<script src="js/jquery-3.2.1.js"></script>
<script src="js/loader.js"></script>
<script>

    layui.use('form', function () {
        var form = layui.form;
        form.on('submit(login)', function (data) {
            oka.loading.open();
            console.log(data)
            $.ajax({
                url: "/admin/login"
                , type: "POST"
                , async: true
                , data: data.field
                , success: function (t) {
                    oka.loading.close();
                    if (t == "1") {
                        layer.msg('操作成功', {
                            time: 600
                        }, function() {
                            location.href = "index.html";
                        });

                    } else {
                        layer.msg('登录失败', {
                            offset: "m",
                            anim: 6
                        });
                    }

                }
            });
            return false;
        });

    });

</script>

</body>
</html>
